<!DOCTYPE html>
<html>
<head lang="zh">
    <meta charset="UTF-8">
    <meta name="viewport" content="initial-scale=1, maximum-scale=1, user-scalable=no">
    <title>首页</title>
<#include "admin/common.ftl"/>
    <link rel="icon" href="${base}/static/favicon.ico" mce_href="${base}/static/favicon.ico" type="image/x-icon"/>
    <link rel="shortcut icon" href="${base}/static/favicon.ico" mce_href="${base}/static/favicon.ico" type="image/x-icon"/>
    <link rel="stylesheet" href="${base}/static/arcgis_js_api/library/4.0/4.0/dijit/themes/claro/claro.css"/>
    <link rel="stylesheet" href="${base}/static/arcgis_js_api/library/4.0/4.0/esri/css/main.css"/>
    <style type="text/css">
        html,body {margin:0;padding:0;width:100%;height:100%;}
        .banner{font-size:30px;font-weight:bold;font-family:"华文隶书";color:#F7F7F7;text-align:left;height:40px;width:70%;line-height:40px;float:left;margin-top:0;}
        .banner img{height:50px;width: 100%;margin:-5px;}
        .loginInfo{text-align:right;width:30%;margin-top:26px;float:left;color:#F7F7F7;}
        #menuType{border-right:none;border-left:none;border-bottom:none;}
        #menuType a{height:30px;line-height:30px;margin-bottom:10px;margin-right:6px;}
        #menuType a .l-btn-text{height:30px;line-height:30px;}

        #viewDiv{width:100%;height:100%;padding:0;margin:0;}
    </style>
    <script type="text/javascript" src="${base}/static/arcgis_js_api/library/4.0/4.0/init.js"></script>
</head>
<body class="easyui-layout">
<#-- 头部标题 -->
<div data-options="region:'north',border:false" style="height:50px;padding:5px;background-color:rgb(93, 130, 200);color:#eee;">
    <div class="banner">
        <img src="${base}/static/images/banner.png">
    </div>
    <div class="loginInfo">登录用户：${account.accName}&nbsp;&nbsp;姓名：${account.nickName}&nbsp;&nbsp;角色：系统管理员<a href="${base}/admin/logout" style="margin-left: 10px;">退出</a></div>
</div>

<#-- 左侧导航 -->
<div data-options="region:'west',split:true,title:'部门图层',iconCls:'icon-ehome-standard-layers'" style="width:250px;padding: 0">
    <div id="menuTree" class="easyui-layout" style="width: 100%;height: 100%">
        <div id="menuList" data-options="region:'north',border:false" style="height: 80%">
            <div class="easyui-tree" id="moduleTree" data-options="lines:true,animate:true,onSelect:onSelectTree"></div>
        </div>
        <div id="menuType" data-options="region:'south',split:true" style="height: 20%;padding: 15px;">
            <div style="text-align: center">
            <a class="easyui-linkbutton" onclick="addLayer()" data-options="iconCls:'icon-ehome-standard-add',plain:false">新建图层</a>
            <a class="easyui-linkbutton" onclick="removeLayer()" data-options="iconCls:'icon-ehome-standard-trash',plain:false">移除图层</a>
            <a class="easyui-linkbutton" onclick="queryLayer()" data-options="iconCls:'icon-ehome-standard-search',plain:false">查&nbsp;&nbsp;询</a>
            <a class="easyui-linkbutton" onclick="statistic()" data-options="iconCls:'icon-ehome-standard-analytics',plain:false">统计汇总</a>
            </div>
        </div>
    </div>
</div>

<#-- 页脚信息 -->
<div data-options="region:'south',border:false" style="height:20px; background:#F3F3F3; padding:2px; vertical-align:middle;text-align: right;">
    <span id="sysVersion">系统版本：V1.0</span>
    <span id="nowTime"></span>
</div>

<#--
    ArcGIS服务：http://10.9.3.122:6080/arcgis/rest/services/chinamapservice/MapServer
-->
<#-- 地图显示区域 -->
<div id="center" data-options="region:'center'">
    <div id="map-view"></div>
</div>

<script type="text/javascript">
    //系统时间显示
    setInterval("document.getElementById('nowTime').innerHTML=new Date().toLocaleString()+' 星期'+'日一二三四五六'.charAt(new Date().getDay());", 1000);

    $(function () {
        initArcGISMap();
//        loadDeptAndLayer();
    });

    function initArcGISMap() {
        require("esri.map");
        function init() {
            var myMap = new esri.Map("map-view");
            var myTiledMapServiceLayer = new esri.layers.ArcGISTiledMapServiceLayer("http://10.9.3.122:6080/arcgis/rest/services/chinamapservice/MapServer");
            myMap.addLayer(myTiledMapServiceLayer);
        }
        addOnLoad(init);
    }

    // 加载部门和部门图层
    function loadDeptAndLayer() {
        $.ajax({
            type: "post",
            url: "${base}/admin/dept/listDeptLayer",
            dataType: "json",
            success: function (result) {
                var status = result.status;
                if (status == "success") {
                    var data = result.data;
                    var html = "";
                }
            }
        });
    }

    // 新建部门图层
    function addLayer() {
        
    }

    // 移除图层
    function removeLayer() {
        
    }

    // 查询
    function queryLayer() {

    }

    // 统计汇总
    function statistic() {

    }

    // 当选中树节点时
    function onSelectTree(node) {
        if (node.pid == "" || node.pid == undefined) {
            $(this).tree("toggle", node.target);
        }
    }

    // 选中大模块菜单时改变其样式
    function changeStyle($this) {
        $($this).find("div:first").addClass("ehome-panel-selected");
        $($this).siblings().find("div:first").removeClass("ehome-panel-selected");
    }
</script>
</html>